import Service from '@/api/config/request'

/**
 * @description: 获取基础题目类型
 * @return {Promise}
 */
export const getProblemListType = () => {
  return Service.request({
    url:  '/api/problem/listType',
    method: 'GET',
  })
}

/**
 * @description: 获取基础题目
 * @return {Promise}
 */
export const getProblemListBasic = () => {
  return Service.request({
    url:  '/api/problem/listBasic',
    method: 'GET',
  })
}

/**
 * @description: 获取收藏的题目
 * @return {Promise}
 */
export const getStarList = () => {
  return Service.request({
    url:  '/api/problem/listStar',
    method: 'POST',
  })
}

/**
 * @description: 收藏题目
 * @return {Promise}
 * @param problem 要收藏的问题对象
 */
export const starProblem = (problem) => {
  return Service.request({
    data: {
      problem,
    },
    url:  '/api/problem/star',
    method: 'POST',
  })
}

/**
 * @description: 取消收藏题目
 * @return {Promise}
 * @param id 取消收藏的问题ID
 */
export const cancelStarProblem = (id) => {
  return Service.request({
    data: {
      id,
    },
    url:  '/api/problem/star',
    method: 'POST',
  })
}
